<template>
  <div class="user-panel">
    <div class="user-info">
      <div class="avatar">
        <img src="https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png" alt="用户头像">
      </div>
      <div class="greeting">
        <p>Hi，欢迎来到京东</p>
        <div class="login-btns">
          <el-button size="small" type="danger">登录</el-button>
          <el-button size="small">注册</el-button>
        </div>
      </div>
    </div>
    
    <div class="user-benefits">
      <div class="benefit-item">
        <el-icon><Ticket /></el-icon>
        <span>PLUS会员</span>
      </div>
      <div class="benefit-item">
        <el-icon><Goods /></el-icon>
        <span>企业采购</span>
      </div>
      <div class="benefit-item">
        <el-icon><Money /></el-icon>
        <span>京东金融</span>
      </div>
    </div>
    
    <div class="news-section">
      <div class="news-header">
        <div class="tabs">
          <span class="tab active">促销</span>
          <span class="tab">公告</span>
          <span class="tab">活动</span>
        </div>
        <a href="#" class="more">更多</a>
      </div>
      <div class="news-list">
        <a href="#" class="news-item">618年中大促销品类秒杀</a>
        <a href="#" class="news-item">家电联合满2000减200</a>
        <a href="#" class="news-item">手机限时抢券300减50</a>
        <a href="#" class="news-item">电脑配件满399减30</a>
      </div>
    </div>
  </div>
</template>

<script setup>
import { Ticket, Goods, Money } from '@element-plus/icons-vue';
</script>

<style lang="scss" scoped>
.user-panel {
  background-color: white;
  border-radius: 8px;
  padding: 15px;
  height: 100%;
  display: flex;
  flex-direction: column;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  
  .user-info {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #f0f0f0;
    
    .avatar {
      width: 60px;
      height: 60px;
      border-radius: 50%;
      overflow: hidden;
      margin-right: 15px;
      border: 1px solid #eee;
      
      img {
        width: 100%;
        height: 100%;
        object-fit: cover;
      }
    }
    
    .greeting {
      flex: 1;
      
      p {
        font-size: 15px;
        margin-bottom: 8px;
      }
      
      .login-btns {
        display: flex;
        gap: 10px;
      }
    }
  }
  
  .user-benefits {
    display: flex;
    justify-content: space-between;
    padding: 10px 0 15px;
    margin-bottom: 15px;
    border-bottom: 1px solid #f0f0f0;
    
    .benefit-item {
      display: flex;
      flex-direction: column;
      align-items: center;
      cursor: pointer;
      
      .el-icon {
        font-size: 24px;
        color: var(--primary-color);
        margin-bottom: 5px;
      }
      
      span {
        font-size: 13px;
      }
      
      &:hover span {
        color: var(--primary-color);
      }
    }
  }
  
  .news-section {
    flex: 1;
    
    .news-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 10px;
      
      .tabs {
        display: flex;
        
        .tab {
          font-size: 14px;
          padding: 0 8px;
          cursor: pointer;
          position: relative;
          
          &:not(:last-child):after {
            content: '';
            position: absolute;
            right: 0;
            top: 50%;
            transform: translateY(-50%);
            width: 1px;
            height: 12px;
            background-color: #ddd;
          }
          
          &.active {
            color: var(--primary-color);
            font-weight: bold;
          }
        }
      }
      
      .more {
        font-size: 13px;
        color: #999;
        
        &:hover {
          color: var(--primary-color);
        }
      }
    }
    
    .news-list {
      display: flex;
      flex-direction: column;
      
      .news-item {
        padding: 6px 0;
        font-size: 13px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        
        &:hover {
          color: var(--primary-color);
        }
      }
    }
  }
}
</style> 